Skip to content

fix: use JSON output for server status parsing in run-mcp-server#13

Merged
JAORMX merged 1 commit into
mainfrom
fix/run-mcp-server-json-parsing
Mar 19, 2026
Merged

fix: use JSON output for server status parsing in run-mcp-server#13
JAORMX merged 1 commit into
mainfrom
fix/run-mcp-server-json-parsing

Conversation

@JAORMX

@JAORMX JAORMX commented Mar 19, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Fix broken server detection: grep -E "server|" (empty regex alternative when inputs.name is unset) matched every line including the header row, causing outputs to be literal column headers (URL: URL, Port: PORT) and the readiness check to always time out after 30s.
  • Switch to structured JSON parsing: Replace fragile grep/awk text parsing with thv list --format json | jq for reliable field extraction.
  • Fix expression injection: Move ${{ }} expressions from run: blocks into env: mappings to prevent script injection in the affected steps.

Discovered via stacklok/brood-box#69 CI failure: https://github.com/stacklok/brood-box/actions/runs/23282849605/job/67699830961

Test plan

  • Re-run brood-box#69 CI against this branch to verify the server starts and is detected correctly
  • Verify thv list --format json + jq correctly extracts name, status, url, port

🤖 Generated with Claude Code

The grep/awk parsing of `thv list` text output was broken when
`inputs.name` was empty: `grep -E "server|"` matched every line
(including the header row), causing outputs to be literal column
headers ("URL", "PORT", "STATUS") and the readiness check to
always time out.

Switch to `thv list --format json` with jq for reliable structured
parsing. Also move ${{ }} expressions into env: blocks to prevent
script injection.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@JAORMX JAORMX merged commit 87b30f1 into main Mar 19, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant